﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ClearShould.cs" company="SaltFx">
//   Copyright (c) SaltFx - All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace SaltFx.Domain.Tests.DomainEventing
{
	using System;
	using System.Collections.Generic;

	using NUnit.Framework;

	/// <summary>
	/// The DomainEvents Clear method tests.
	/// </summary>
	public class ClearShould
	{
		#region Public Methods

		/// <summary>
		/// Ensures that registered callback actions are cleared.
		/// </summary>
		[Test]
		public void ClearAllCallbackActions()
		{
			DomainEvents.Register<TestDomainEvent>(x => x.NewName = "GOT IT");

			DomainEvents.Clear();

			var actions = Local.Data[DomainEvents.DomainEventActionsKey] as List<Delegate>;

			Assert.That(actions == null);
		}

		#endregion
	}
}